<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>

    #leftmain{

      border-style:solid ;
      border-color: #b9def0;
    }
  </style>
</head>
<body>
<h2>论文发表页面</h2>


<div id="leftmain" style=" width: 500px; height: 600px;">

  <p>论文题目:<input type="text" id="title" /></p>
  <p><form action="http://vip.biancheng.net/login.php" method="post" id="typeCode">
  类型：
  <select>
    <option>应用</option>
    <option>实际</option>

  </select>
</form>
  </p>
    <p>论文内容:<textarea id="paperSummary"></textarea></p>
  <p>文件:<input type="file" ></p>
  <input type="button" value="保存" onclick="add()"/>
  <input type="button" value="返回"/>
</div>
<script src="http://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
<script>

  $(function (){


  });
  function add(){

    var title=$("#title").val();

    var typeCode=$("#typeCode").text();
    //评论内容
    var paperSummary=$("#paperSummary").val();
    if(title==null || title.equals('')){
      alert("标题为空")

    }else if(typeCode==null || typeCode.equals('')){

      alert("不能为空")

    }else{
    $.ajax({
      "url": '/addlunwen',
      "type": "get",
      "data":{"title":title,"typeCode":typeCode,"paperSummary":paperSummary},
      "dataType": "json",
      "success": function (a) {

        if(a==true){

          alert("添加成功");
        }
      },
      error: function () {
        alert("加载失败");
        // window.location.href = "./index.html";
      }
    });
    }

  }
</script>
</body>
</html>